<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>自己所有的作品</title>
    <link rel="stylesheet" href="util/css/bootstrap.min.css">
    <link rel="stylesheet" href="util/font/iconfont.css">
    <link rel="stylesheet" href="util/css/public.css">
    <link rel="stylesheet" href="util/css/main.css">
</head>
<body>
<div class="container" style="margin-top: 20px;">
    <div class="row">
<form id="domeFrom" name="domeFrom" action="addDome.action" enctype="multipart/form-data" method="post">
    <div class="form-group col-sm-3">
        <label for="location1">请选择上传的项目</label>
        <input id='location1' class="form-control" disabled>
        <input type="button" id="i-check1" value="浏览" class="btn btn-info" onclick="$('#i-file1').click();" style="margin-top:10px;">
        <input type="file" id='i-file1' name="domeUp"  accept=".war" onchange="$('#location1').val($('#i-file1').val());" style="display: none;">
    </div>
    <div class="form-group col-sm-3">
        <label for="location">请选择项目图片</label>
        <input id='location' class="form-control " disabled>
        <input type="button" id="i-check" value="浏览" class="btn btn-info" onclick="$('#i-file').click();" style="margin-top:10px;">
        <input type="file" id='i-file' name="domeUp"  accept=".png" onchange="$('#location').val($('#i-file').val());" style="display: none;">
    </div>
    <div class="form-group col-sm-3">
    <label for="inputName">请输入项目名称</label>
        <div>
        <input id="inputName" class="form-control"  type="text" name="name" placeholder="请输入项目名称">
        </div>
    </div>
    <div class="form-group col-sm-3">
    <label for="inputUrl">请输入项目名称</label>
    <div>
        <input id="inputUrl" class="form-control"  type="text" name="initialUrl" placeholder="请输入初始的访问地址如/login/**">
    </div>
    </div>
    <span style="visibility: hidden;color: red" id="result1">请填写完整信息后提交</span>
    <span style="visibility: hidden;color: red" id="result">请耐心等待上传完成后页面会自动</请耐心等待上传完成后页面会自动>更新</span>
    <input class="btn-danger btn" type="button" value="提交" style="float: right;" id="submit1"/>
</form>
    </div>
    <div class="row" id="dome">
</div>
</div>
</body>
<script src="util/js/jquery-3.3.1.min.js"></script>
<script src="util/js/bootstrap.min.js"></script>
<script src="util/js/main.js"></script>
<script>
    $(function () {
        $.ajax({
            type:"post",
            url:"ajaxJsonA",
            data:"",
            dataType:"json",
            contentType:"application/json",
            error:function(retult){alert("出错了："+ retult.error);},
            success:function (retult) {
                var data = JSON.parse(retult);
                var htmls = $("#dome").html();
                for(var i = 0; i<data.length;i++){
                    var html ="<div class='search_box col-sm-3' style='margin-left: 20px; margin-right: 10px;'><a href='"+data[i].domeUrl +"'><img src='"+data[i].imgUrl+"' style='width: 100%;max-height: 250px'>"
                        +"<h4 style='text-align: center;'>"+data[i].name+"</h4>"
                        +"<div class='cb'></div></a></div>"
                    htmls = html+htmls;
                }
                $("#dome").html(htmls);
            },
        })
        $("#submit1").click(function () {
            var remind = false;
            if($("#i-file1").val().length>0){
                if($("#i-file").val().length>0){
                    if($("#inputUrl").val().length>0){
                        if($("#inputName").val().length>0){
                            remind = true;
                        }
                    }
                }
            }
            if(remind){
            $("#result1").css("visibility","hidden");
            $("#result").css("visibility","visible");
                document.getElementById("domeFrom").submit();
            }else{
            $("#result1").css("visibility","visible");
            }
        })
    })
</script>
</html>